import 'dart:convert';

TrialDriveEntity TrialDriveEntityFromJson(String str) => TrialDriveEntity.fromJson(json.decode(str));

String TrialDriveEntityToJson(TrialDriveEntity data) => json.encode(data.toJson());

class TrialDriveEntity {
  int id;
  int clueId;
  int shopId;
  int status;
  String customerName;
  String phone;
  String province;
  String city;
  int shopType;
  String shopName;
  String saleMan;
  String createdBy;
  DateTime createdAt;
  DateTime registrationTime;
  DateTime appointTime;
  int driveType;
  int driveMethod;
  dynamic modelName;
  String driveVehicle;
  DateTime startDriveTime;
  DateTime endDriveTime;
  int driveDuration;
  String driveMile;
  String modelId;
  int driveFrom;
  DateTime appointDate;
  int isProbe;
  int probeBy;
  DateTime probeTime;
  String description;
  String remark;
  String updatedBy;
  DateTime updatedAt;
  dynamic cancelTime;
  String driveExperience;

  TrialDriveEntity({
    required this.id,
    required this.clueId,
    required this.shopId,
    required this.status,
    required this.customerName,
    required this.phone,
    required this.province,
    required this.city,
    required this.shopType,
    required this.shopName,
    required this.saleMan,
    required this.createdBy,
    required this.createdAt,
    required this.registrationTime,
    required this.appointTime,
    required this.driveType,
    required this.driveMethod,
    required this.modelName,
    required this.driveVehicle,
    required this.startDriveTime,
    required this.endDriveTime,
    required this.driveDuration,
    required this.driveMile,
    required this.modelId,
    required this.driveFrom,
    required this.appointDate,
    required this.isProbe,
    required this.probeBy,
    required this.probeTime,
    required this.description,
    required this.remark,
    required this.updatedBy,
    required this.updatedAt,
    required this.cancelTime,
    required this.driveExperience,
  });

  factory TrialDriveEntity.fromJson(Map<String, dynamic> json) => TrialDriveEntity(
    id: json["id"],
    clueId: json["clueId"],
    shopId: json["shopId"],
    status: json["status"],
    customerName: json["customerName"],
    phone: json["phone"],
    province: json["province"],
    city: json["city"],
    shopType: json["shopType"],
    shopName: json["shopName"],
    saleMan: json["saleMan"],
    createdBy: json["createdBy"],
    createdAt: DateTime.parse(json["createdAt"]),
    registrationTime: DateTime.parse(json["registrationTime"]),
    appointTime: DateTime.parse(json["appointTime"]),
    driveType: json["driveType"],
    driveMethod: json["driveMethod"],
    modelName: json["modelName"],
    driveVehicle: json["driveVehicle"],
    startDriveTime: DateTime.parse(json["startDriveTime"]),
    endDriveTime: DateTime.parse(json["endDriveTime"]),
    driveDuration: json["driveDuration"],
    driveMile: json["driveMile"],
    modelId: json["modelId"],
    driveFrom: json["driveFrom"],
    appointDate: DateTime.parse(json["appointDate"]),
    isProbe: json["isProbe"],
    probeBy: json["probeBy"],
    probeTime: DateTime.parse(json["probeTime"]),
    description: json["description"],
    remark: json["remark"],
    updatedBy: json["updatedBy"],
    updatedAt: DateTime.parse(json["updatedAt"]),
    cancelTime: json["cancelTime"],
    driveExperience: json["driveExperience"],
  );

  Map<String, dynamic> toJson() => {
    "id": id,
    "clueId": clueId,
    "shopId": shopId,
    "status": status,
    "customerName": customerName,
    "phone": phone,
    "province": province,
    "city": city,
    "shopType": shopType,
    "shopName": shopName,
    "saleMan": saleMan,
    "createdBy": createdBy,
    "createdAt": createdAt.toIso8601String(),
    "registrationTime": registrationTime.toIso8601String(),
    "appointTime": appointTime.toIso8601String(),
    "driveType": driveType,
    "driveMethod": driveMethod,
    "modelName": modelName,
    "driveVehicle": driveVehicle,
    "startDriveTime": startDriveTime.toIso8601String(),
    "endDriveTime": endDriveTime.toIso8601String(),
    "driveDuration": driveDuration,
    "driveMile": driveMile,
    "modelId": modelId,
    "driveFrom": driveFrom,
    "appointDate": appointDate.toIso8601String(),
    "isProbe": isProbe,
    "probeBy": probeBy,
    "probeTime": probeTime.toIso8601String(),
    "description": description,
    "remark": remark,
    "updatedBy": updatedBy,
    "updatedAt": updatedAt.toIso8601String(),
    "cancelTime": cancelTime,
    "driveExperience": driveExperience,
  };
}
